<template>
  <div>
    <!--1.视图-->
    <el-table v-loading="loading" :data="dataList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="代办编号" align="center" key="taskId" prop="taskId" />
      <el-table-column label="代办昵称" align="center" key="taskName" prop="taskName" />
      <el-table-column label="代办名称" align="center" key="taskAssignee" prop="taskAssignee" />
      <el-table-column label="开始时间" align="center" key="startTime" prop="startTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.startTime) }}</span>
        </template>
      </el-table-column>
      <el-table-column label="结束时间" align="center" key="endTime" prop="endTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.endTime) }}</span>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>

<script>
import {selectHistoryList,selectComplete} from "@/api/note/applys";

export default {
  name: "index",
  data() {
    return {
      //2.属性定义
      //2.属性定义
      dialogFormVisible:false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      timeValue: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 字典表格数据
      dataList: [],
      // 默认字典类型
      defaultLeaveType: "",
      // 弹出层标题
      title: "",
      // 类型数据字典
      typeOptions: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        LeaveName: undefined,
        proposer: undefined,
        title: undefined
      },
      // 表单参数
      form: {},
    }
  }, methods: {
    //3.方法
    /** 审批按钮操作 */
    tongyi(row){
      selectComplete({
        taskId:row.taskId,
        taskName:row.taskName,
        days:row.days,
      }).then(r=>{
        this.getList();
      })
    },
    getList(){
      this.loading=true;
      selectHistoryList().then(r=>{
        this.dataList = r;
        this.loading=false;
      })
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.leaveId)
      this.single = selection.length!=1
      this.multiple = !selection.length
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.queryParams.LeaveName = this.defaultLeaveType;
      this.handleQuery();
    },
  }, created() {
    //4.钩子函数
    this.getList();
  }
}
</script>

<style scoped>

</style>
